package com.yi.serviceprice.generator;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.Collections;

/**
 * 自动生成代码工具类
 */
public class MysqlGenerator {
    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://localhost:3306/service-price?characterEncoding=utf-8&serverTimezone=GMT%2B8"
                        , "root", "1234")
                .globalConfig(builder -> {
                    builder.author("田毅").fileOverride().outputDir("E:\\IDEA\\git\\online-taix-2022-public\\online-taix-public\\service-price\\src\\main\\java");
                }).packageConfig(builder -> {
                    builder.parent("com.yi.serviceprice").pathInfo(Collections.singletonMap(OutputFile.mapperXml
                            , "E:\\IDEA\\git\\online-taix-2022-public\\online-taix-public\\service-price\\src\\main\\java\\com\\yi\\serviceprice\\mapper"));
                }).strategyConfig(builder -> {
                    builder.addInclude("price_rule");
                }).templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }

}
